import com.zlx.xBiaoShop.dao.OrderDao;
import com.zlx.xBiaoShop.dao.RecvAddrDao;
import com.zlx.xBiaoShop.dao.TypeDao;
import com.zlx.xBiaoShop.dao.UserDao;
import com.zlx.xBiaoShop.entity.Order;
import com.zlx.xBiaoShop.entity.RecvAddr;
import com.zlx.xBiaoShop.mapper.OrderMapper;
import com.zlx.xBiaoShop.xBiaoShop;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@SpringBootTest(classes = xBiaoShop.class)
@RunWith(SpringRunner.class)
public class Tsetdao {

    @Autowired
    private RecvAddrDao recvAddrDao;

    @Autowired
    private UserDao userDao;

    @Autowired
    private OrderMapper orderMapper;

    @Autowired
    private TypeDao typeDao;


    @Test
    public void tsetDao(){
        typeDao.findAll();
//        orderMapper.updateTotalManeyAndCountById(12,12400D,"97113fcc3fef415eb103d74174ab640c");
//        List<Order> oderById = orderMapper.getOderByUserId(2);
//        System.out.println(oderById);
//        for (Order order : oderById) {
//            System.out.println(order.getGoods().getId());
//        }
//        orderMapper.changeGoodCount("1acb87d4a0314830884ae685a588b40a",2,4999D);
//        List<Order> payedOrderByUserId = orderMapper.getPayedOrderByUserId(2);
//        System.out.println(payedOrderByUserId);
//        List<RecvAddr> all = recvAddrDao.findAll();
//        recvAddrDao.findByUserId(2);
//        userDao.updateDefalutAddrById(2,4);
//        RecvAddr addr = new RecvAddr();
//        addr.setArea("46564");
//        addr.setDetailAddr("4646");
//        addr.setPhone("654646");
//        addr.setPostCode("4564");
//        addr.setRecvName("5465");
//        addr.setUserId(2);
//        RecvAddr save = recvAddrDao.save(addr);
//        System.out.println(save.getId());
//        System.out.println(all);
    }
}
